package net.xiaohanlin.smartmetric.reporter;

import java.util.concurrent.TimeUnit;

import com.codahale.metrics.ScheduledReporter;

public class SmartMetricsInfluxdbReporter implements SmartMetricsScheduleReporter {

	private long period;
	private TimeUnit timeUnit;

	long getPeriod() {
		return period;
	}

	void setPeriod(long period) {
		this.period = period;
	}

	TimeUnit getTimeUnit() {
		return timeUnit;
	}

	void setTimeUnit(TimeUnit timeUnit) {
		this.timeUnit = timeUnit;
	}

	public ScheduledReporter getScheduledReporter() {
		return scheduledReporter;
	}

	public void setScheduledReporter(ScheduledReporter scheduledReporter) {
		this.scheduledReporter = scheduledReporter;
	}

	private ScheduledReporter scheduledReporter;

	public SmartMetricsInfluxdbReporter(long period, TimeUnit timeUnit, ScheduledReporter scheduledReporter) {
		super();
		this.period = period;
		this.timeUnit = timeUnit;
		this.scheduledReporter = scheduledReporter;
	}

	@Override
	public void scheduleSmartMetricsReporter() {
		this.scheduledReporter.start(period, timeUnit);
	}

}
